package Test;

import java.util.Random;

public class test1 {
    public static void main(String[] args) {
        //将数组内的数打乱顺序并添加进二维数组
        int[] arr = new int[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        Random r = new Random();
        for (int i = 0; i < arr.length; i++) {
            int index = r.nextInt(arr.length);
            int tmp = arr[i];
            arr[i]=arr[index];
            arr[index]=tmp;
        }
        int[][] Arr = new int[4][4];
        for (int i = 0; i < arr.length; i++) {
            Arr[i/4][i%4] = arr[i];
        }
        for (int i = 0; i < Arr.length; i++) {
            for (int j = 0; j < Arr[i].length; j++) {
                System.out.print(Arr[i][j] + " ");
            }
            System.out.println();
        }
    }
}
